package com.school.dishi.controller;

import com.school.dishi.common.R;
import com.school.dishi.domain.vo.DishVO;
import com.school.dishi.service.IDishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dish")
public class DishController {

    @Autowired
    private IDishService dishService;

    @GetMapping("/category")
    public R<List<DishVO>> getDishesByCategoryId(Long categoryId) {
        List<DishVO> dishVOList = dishService.getDishesWithFlavorsByCategoryId(categoryId);
        return R.success(dishVOList);
    }

}
